# Maintainer: David Runge <dvzrv@archlinux.org>

_name=sphinx-click
pkgname=python-sphinx-click
pkgver=4.4.0
pkgrel=2
pkgdesc="Sphinx plugin to automatically document click-based applications"
arch=(any)
url="https://github.com/click-contrib/sphinx-click"
license=(MIT)
depends=(python-click python-docutils python-sphinx)
makedepends=(python-build python-installer python-pbr python-setuptools python-wheel)
checkdepends=(python-pytest python-click)
source=(https://files.pythonhosted.org/packages/source/${_name::1}/$_name/$_name-$pkgver.tar.gz)
sha512sums=('74a1dc653ccf2d424bfbd419291973822e4dea6a73d5a9e6033b48f585d53f2df3400936fa8c875b0fb4259a0f364ddf4d7bc4064e98c7ac47cd4114154f6d60')
b2sums=('b37a9ad119b4cfd62df4dff112a204d6b3863e4accc846194fdd76aa56e349a56e2289c6a783749d99169cb1552d7dc81add5633a99566a2db426f42edb28352')

build() {
  cd $_name-$pkgver
  python -m build --wheel --no-isolation
}

check() {
  cd $_name-$pkgver
  pytest -vv
}

package() {
  cd $_name-$pkgver
  python -m installer --destdir="$pkgdir" dist/*.whl
  install -vDm 644 {AUTHORS,ChangeLog,README.rst} -t "$pkgdir/usr/share/doc/$pkgname/"
  install -vDm 644 docs/*.rst -t "$pkgdir/usr/share/doc/$pkgname/docs/"
  install -vDm 644 LICENSE -t "$pkgdir/usr/share/licenses/$pkgname/"
}
